<template>
  <div>
    <el-card>
      <h3>上传记录</h3>
    </el-card>
    <el-card>
      <div>
        <el-form :inline="true" :model="UplineRecord">
          <!-- <el-form-item label="上传用户:">
            <el-input v-model="UplineRecord.RecordUser" placeholder="用户ID/账号" clearable></el-input>
          </el-form-item>
          <el-form-item label="文件名:">
            <el-input v-model="UplineRecord.RecordName" placeholder="用户ID/账号" clearable></el-input>
          </el-form-item> -->
          <el-form-item>
            <el-button type="primary" @click="QueryJIlu">查询记录</el-button>
          </el-form-item>
          <el-form-item>
            <el-button @click="Resetting">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-table :data="RecordList.records" style="width: 100%">
        <el-table-column prop="createDate" label="日期" width="200">
        </el-table-column>
        <el-table-column prop="username" label="账号" width="120">
        </el-table-column>
        <el-table-column prop="modelKey" label="模型标识key" width="160">
        </el-table-column>
        <el-table-column prop="ip" label="IP" width="160">
        </el-table-column>
        <el-table-column prop="taskId" label="taskId" width="300">
        </el-table-column>
        <el-table-column prop="fileStatus" label="文件状态">
          <template slot-scope="scope">
            <span>{{ scope.row.fileStatus }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="params" label="文件">
          <template slot-scope="scope">
            <span>{{ scope.row.params }}</span>
          </template>
        </el-table-column>
      </el-table>

      
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
              :page-sizes="[10, 50, 100, 1000]" :page-size="10" layout="total, sizes, prev, pager, next, jumper"
              :total="RecordList.total" style="margin: 20px 0;float: right;">
          </el-pagination>
    </el-card>
  </div>
</template>

<script>
import { UserUploadfile } from '@/api/table'

export default {
  data() {
    return {
      RecordList: [],
      UplineRecord: {
        RecordUser: '',
        RecordName: ''
      },
      page: 1,
      size: 10,
    };
  },
  created() {
    this.QueryJIlu()
  },
  methods: {
    //chaxun
    async QueryJIlu() {
      UserUploadfile(this.page, this.size).then(res => {
        this.RecordList = res.data
      })
    },

    async handleSizeChange(val) {
          this.size = val;
          this.QueryJIlu()
      },
      async handleCurrentChange(val) {
          this.page = val;
          this.QueryJIlu()

      },
    // 清空每一项的值
    clearObject(obj) {
      for (let key in obj) {
        if (obj.hasOwnProperty(key)) {
          obj[key] = '';
        }
      }
    },




    // 重置
    Resetting() {
      this.clearObject(this.UplineRecord)
      this.QueryJIlu()

    }
  },
};
</script>

<style lang="scss" scoped></style>
